import Vue from 'vue'
import App from './App.vue'

//引入vue-resource请求数据
import VueResource from 'vue-resource';
Vue.use(VueResource);


/*引入vue-router路由*/
import VueRouter from 'vue-router';
Vue.use(VueRouter);

/*引入组件*/
import Start from './components/Start.vue';
import Edit from './components/Edit.vue';
import Home from './components/Home.vue';
import Pcontent from './components/Pcontent.vue';
import Cart from './components/Cart.vue';
import Hot from './components/Hot.vue';

import Search from './components/Search.vue';
import Order from './components/Order.vue';

/*配置路由*/
const routes = [
  { path: '/start', component: Start},
  { path: '/edit', component: Edit},
  { path: '/home', component: Home },
  { path: '/pcontent/:id', component: Pcontent }, 
  { path: '/cart', component: Cart }, 
  { path: '/hot', component: Hot},
  { path: '/start', component: Start},
  { path: '/search', component: Search},
  { path: '/order', component: Order},
  { path: '*', redirect: '/start' }//默认跳转路由
];

/*实例化VueRouter*/
const router = new VueRouter({
  routes // （缩写）相当于 routes: routes
});



new Vue({
  el: '#app',
  router,
  render: h => h(App)
})
